/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.wechat.score.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.thinkgem.jeesite.common.persistence.BaseDao;
import com.thinkgem.jeesite.common.persistence.BaseDaoImpl;
import com.boxin.ims.modules.wechat.entity.LotteryRecord;
import com.boxin.ims.modules.wechat.score.entity.ScoreExchange;

/**
 * 积分对换设置DAO接口
 * @author Jakemanse
 * @version 2013-09-23
 */
public interface ScoreExchangeDao extends ScoreExchangeDaoCustom, CrudRepository<ScoreExchange, Long> {

	@Modifying
	@Query("update ScoreExchange set delFlag='" + ScoreExchange.DEL_FLAG_DELETE + "' where id = ?1")
	public int deleteById(Long id);
	
	@Modifying
	@Query("update ScoreExchange set delFlag='" + LotteryRecord.DEL_FLAG_NORMAL + "',status = ?2 ,update_time = now()  where id = ?1")
	public int updateStatusById(Long id,String status);
	
}

/**
 * DAO自定义接口
 * @author Jakemanse
 */
interface ScoreExchangeDaoCustom extends BaseDao<ScoreExchange> {

}

/**
 * DAO自定义接口实现
 * @author Jakemanse
 */
@Component
class ScoreExchangeDaoImpl extends BaseDaoImpl<ScoreExchange> implements ScoreExchangeDaoCustom {

}
